#@layout()
#define main()
<h1>销售费用单(NC应收单)&nbsp;&nbsp;
</h1>
<form action="/xhfyd" method="get">
	<label for="djbh">单据编号：</label>
	<input class="text" type="" name="djbh">
	<label for="djbh">供应商代码：</label>
	<input class="text" type="" name="gysdm">
	<label for="djbh">供应商名称：</label>
	<input class="text" type="" name="gysmc"><br>
	<label for="startdate">时间范围：</label>
	<input class="text" type="" name="startdate" id="start-calendar">~
	<input class="text" type="" name="enddate" id="end-calendar">
	<input class="submit" type="submit" name="submit" value="搜索">
</form>
<input type="button" name="plcl" id="plcl" value="批量更新">
<div class="table_box">
	<table class="list">
		<tbody>
			<tr>
				<th width="5%" style="text-align:center;vertical-align: middle;"><input class="table_check_all" style="zoom: 200%" type='checkbox' value='1' name='ALL' /></th>
				<th width="10%">单据编号</th>
				<th width="8%">日期</th>
				<th width="10%">供货商代码</th>
				<th width="25%">供货商名称</th>
				<th width="8%">付款方式</th>
				<th width="8%">付款金额</th>
				<th width="10%">备注</th>
				<th width="8%">NC有无</th>
				<th width="8%">操作</th>
			</tr>
			
			#for(x : xhfydPage.getList())
			<tr>
				<td style="text-align:center;vertical-align: middle;" class="list-div"><input style="zoom: 200%" class="table_check" type='checkbox' value='#(x.DJBH)' name='DJBH' /></td>
				<td style="text-align:left;">#(x.DJBH)</td>
				<td style="text-align:left;">#(x.RQ)</td>
				<td style="text-align:center;">#(x.KHDM)</td>
				<td style="text-align:left;">#(x.KHMC)</td>
				<td style="text-align:center;">#(x.FSMC)</td>
				<td style="text-align:right;">#(x.JE)</td>
				<td style="text-align:left;">#(x.BZ)</td>
				<td style="text-align:center;">#(x.issend)</td>
				<td style="text-align:left;">
					&nbsp;&nbsp;<a href="/xhfyd/syncupdate/#(x.DJBH)">同步更新</a>
				</td>
			</tr>
			#end
		</tbody>
	</table>
	#@paginate(xhfydPage.pageNumber, xhfydPage.totalPage, "/xhfyd/")
</div>
<input type="hidden" class="djbhs" value = "">
<script type="text/javascript" src="/assets/dist/zane-calendar.min.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.9.0.min.js"></script>
<script type="text/javascript">
var startdate = "#(startdate)";
var enddate = "#(enddate)";
#[[
	zaneDate({
		elem:'#start-calendar',
		format:'yyyy-MM-dd HH:mm:ss',
		begintime:startdate,
		showtime:true,
		zindex:500
	})
	zaneDate({
		elem:'#end-calendar',
		format:'yyyy-MM-dd HH:mm:ss',
		begintime:enddate,
		showtime:true,
		zindex:500
	})
]]#
$("#plcl").click(function(){
	var djbhs = $(".djbhs").val();
	if(djbhs == ""){
		alert("请选择单据编号");
		return;
	}
    if(!confirm("是否批量提交")){
        return;
    }
    $.ajax({
        url:"/xhfyd/batchsubmit",
        type:'POST',
        data:{djbhs:djbhs},
        dataType:"json",
        success:function(result){
            if(result['status'] > 0){
                //table.loadList();
                alert("成功");
            }else{
                alert('失败，status:'+result['status']);
            }
        }
    });	
})

function checkbox()
{
    $('.list-div input:checkbox').click(function (){
        setTimeout(function () {
            ids_arr = [];
            $('.table_check:checked').each(function() {
                ids_arr.push($(this).val());
            });
			
            _IN_id = ids_arr.join(",");
    		$(".djbhs").val(_IN_id);
        },200)
    });

    $('.table_check_all').click(function (){
        setTimeout(function () {
            ids_arr = [];
            $('.table_check').each(function() {
                $(this).attr("checked",$('.table_check_all').attr('checked'));
            });
            $('.table_check:checked').each(function() {
                ids_arr.push($(this).val());
            });
            _IN_id = ids_arr.join(",");
    		$(".djbhs").val(_IN_id);
        },200)
    });
}
$(function(){
	checkbox();
});
</script>
#end